package org.tis.tools.abf.module.ac.entity.vo;

import lombok.Data;
import org.tis.tools.abf.module.ac.entity.AcFunc;
import org.tis.tools.abf.module.ac.entity.AcMenu;
import org.tis.tools.abf.module.ac.entity.AcOperatorMenu;
import org.tis.tools.core.utils.StringUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by chenchao
 * Created on 2018/9/14 9:54
 */
@Data
public class AcOperatorMenuDetail {

    private String guid;

    private String guidFunc;

    //菜单名
    private String text;

    private String guidParents;

    //图标
    private String icon;

    private int displayOrder;

    //路径
    private String link;

    private List<AcOperatorMenuDetail> children = new ArrayList<AcOperatorMenuDetail>();

    public AcOperatorMenuDetail(){}

    public AcOperatorMenuDetail(AcMenu acMenu, List<AcFunc> list, String uiEntry){
        this.guid = acMenu.getGuid();
        this.guidFunc = acMenu.getGuidFunc();
        this.text = StringUtil.isNotEmpty(acMenu.getMenuLabel()) ? acMenu.getMenuLabel() : acMenu.getMenuName();
        this.guidParents = acMenu.getGuidParents();
        this.icon = acMenu.getImagePath();
        this.link = uiEntry;
        this.displayOrder = acMenu.getDisplayOrder().intValue();
    }

    public AcOperatorMenuDetail(AcOperatorMenu acOperatorMenu, List<AcFunc> list, String uiEntry){
        this.guid = acOperatorMenu.getGuid();
        this.guidFunc = acOperatorMenu.getGuidFunc();
        this.text = StringUtil.isNotEmpty(acOperatorMenu.getMenuLabel()) ? acOperatorMenu.getMenuLabel() : acOperatorMenu.getMenuName();
        this.guidParents = acOperatorMenu.getGuidParents();
        this.icon = acOperatorMenu.getImagePath();
        this.link = uiEntry;
        this.displayOrder = acOperatorMenu.getDisplayOrder().intValue();
    }

    public AcOperatorMenuDetail(AcOperatorMenuUiEntityDetail acOperatorMenu, List<AcFunc> list){
        this.guid = acOperatorMenu.getGuid();
        this.guidFunc = acOperatorMenu.getGuidFunc();
        this.text = StringUtil.isNotEmpty(acOperatorMenu.getMenuLabel()) ? acOperatorMenu.getMenuLabel() : acOperatorMenu.getMenuName();
        this.guidParents = acOperatorMenu.getGuidParents();
        this.icon = acOperatorMenu.getImagePath();
        this.link = acOperatorMenu.getUiEntry();
        this.displayOrder = acOperatorMenu.getDisplayOrder().intValue();
    }

    public AcOperatorMenuDetail(AcOperatorMenuDetail acOperatorMenuDetail, List<AcOperatorMenuDetail> list){
        this.guid = acOperatorMenuDetail.getGuid();
        this.guidFunc = acOperatorMenuDetail.getGuidFunc();
        this.text = acOperatorMenuDetail.getText();
        this.guidParents = acOperatorMenuDetail.getGuidParents();
        this.icon = acOperatorMenuDetail.getIcon();
        this.link = acOperatorMenuDetail.getLink();
        this.children = list;
    }
}
